home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 138 / 138.xpi / chrome / stumbleupon.jar / content / sendDialog.xul < prev    next >
Extensible Markup Language  |  2009-05-22  |  3KB  |  98 lines

  1. <?xml version="1.0"?>
  2.  
  3. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  4.  
  5. <!DOCTYPE window SYSTEM "chrome://stumbleupon/locale/stumbleupon.dtd" >
  6.  
  7. <dialog id="stumble_send_dialog"
  8.     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  9.     title="StumbleUpon Send"
  10.     buttons="accept,cancel"
  11.     ondialogaccept="return handle_accept();"
  12.   ondialogcancel="return handle_cancel();"
  13.     onload="init()">
  14.  
  15. <stringbundleset id="stringbundleset">
  16.     <stringbundle id="bundle_stumble" src="chrome://stumbleupon/locale/stumbleupon.properties"/>
  17. </stringbundleset>
  18.  
  19. <script type="application/x-javascript">
  20. <![CDATA[
  21.  
  22. var detail;
  23. var textbox;
  24.  
  25. detail = window.arguments[0];
  26. document.getElementById("stumble_send_dialog").setAttribute("title", detail.dialog_title);
  27.  
  28. function init()
  29. {
  30.     // Creating elements programatically works around a Firefox bug
  31.     // related to setting the title attribute (ref: Firefox 1.5, XP).
  32.     // -- JW
  33.  
  34.     var dialog = document.getElementById("stumble_send_dialog");
  35.     dialog.getButton("accept").label = "Send";
  36.     
  37.     var grid = document.createElement("grid");
  38.     dialog.appendChild(grid);
  39.     var columns = document.createElement("columns");
  40.     grid.appendChild(columns);
  41.     var el;
  42.     el = document.createElement("column");
  43.     columns.appendChild(el);
  44.     el = document.createElement("column");
  45.     columns.appendChild(el);
  46.     var rows = document.createElement("rows");
  47.     grid.appendChild(rows);
  48.     var row;
  49.     if (detail.show_target)
  50.     {
  51.         row = document.createElement("row");
  52.         rows.appendChild(row);
  53.         el = document.createElement("label");
  54.         el.setAttribute("value", "To:");
  55.         el.setAttribute("style", "font-weight: bold; text-align: right;");
  56.         row.appendChild(el);
  57.         el = document.createElement("label");
  58.         el.setAttribute("value", detail.target);
  59.         row.appendChild(el);
  60.     }
  61.     row = document.createElement("row");
  62.     rows.appendChild(row);
  63.     el = document.createElement("label");
  64.     el.setAttribute("value", "Subject:");
  65.     el.setAttribute("style", "font-weight: bold;");
  66.     row.appendChild(el);
  67.     var display_url = detail.display_url;
  68.     if (display_url.length > 50)
  69.     {
  70.         display_url = display_url.substr(0, 50) + "...";
  71.     }
  72.     el = document.createElement("label");
  73.     el.setAttribute("value", display_url);
  74.     row.appendChild(el);
  75.  
  76.     textbox = document.createElement("textbox");
  77.     textbox.setAttribute("id", "message");
  78.     textbox.setAttribute("multiline", "false");
  79.     textbox.setAttribute("style", "width: 300px;");
  80.     
  81.     dialog.appendChild(textbox);
  82. }
  83.  
  84. function handle_accept()
  85. {
  86.     detail.message = textbox.value;
  87.     opener.setTimeout(function (parent, detail) { parent.su_handle_send_dialog_accept(detail); }, 0, opener, detail);
  88. }
  89.  
  90. function handle_cancel()
  91. {
  92.     opener.setTimeout(function (parent) { parent.su_invoke_global_event("refresh-referral-menu", null); }, 0, opener);
  93. }
  94.  
  95.  ]]>
  96. </script>
  97. </dialog>
  98.